package com.example.bakend.mapper;

import com.example.bakend.pojo.Book;
import com.example.bakend.pojo.Reader;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ReaderMapper {
    @Select("select * from readers")
    List<Reader> selectReaders();

    @Select("select * from readers where id = #{id}")
    Reader selectReader(Integer readerId);

    @Insert("insert into readers (name,gender,age,contact,create_time,update_time) values (#{name},#{gender},#{age},#{contact},#{createTime},#{updateTime})")
    Integer insertReader(Reader reader);

    Integer updateReader(Reader reader);

    Integer deleteReaders(@Param("ids") List<Integer> ids);

    List<Reader> getReaders(@Param("name") String name,
                            @Param("gender") String gender,
                            @Param("contact") String contact,
                            @Param("updateTimeBegin") LocalDateTime updateTimeBegin,
                            @Param("updateTimeEnd") LocalDateTime updateTimeEnd);


}
